#pragma once

#include <core/log.hpp>

#if defined(NO_HANGUP)
    #define CORE_HANGUP
#else
    #if defined(_MSC_VER) || defined(_WIN32)
        #define CORE_HANGUP __debugbreak()
    #else
        #define CORE_HANGUP __builtin_trap()
    #endif
#endif

#define CORE_ASSERT_MSG(COND, FMT, ...)                                        \
    do {                                                                       \
        if (!(COND)) {                                                         \
            LOG_C("Assertion Failed: " FMT, ##__VA_ARGS__);               \
            CORE_HANGUP;                                                       \
        }                                                                      \
    } while (0)
#define CORE_ASSERT(COND) CORE_ASSERT_MSG(COND, #COND)
